package com.literature.search.file.entity.vo;

import cn.easyes.annotation.Score;
import com.literature.search.core.entity.EsFileObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @Author: DangKong
 * @Date: 2023/3/2 21:43
 * @Description: 存在ES中的父对象
 */



@Data
@ApiModel("存储在ES的文件对象VO")
public class EsFileObjectVO implements Serializable {

    private static final long serialVersionUID = 1L;


    private String id;

    @ApiModelProperty("文件名")
    private String fileName;

    @ApiModelProperty("首页缩略图ID")
    private String thumbId;

    @ApiModelProperty("上传时间")
    private String uploadDate;

    @ApiModelProperty("上传人")
    private String uploadUser;

    @ApiModelProperty("点赞数")
    private Integer like;

    @ApiModelProperty("收藏数")
    private Integer collect;

    @ApiModelProperty("下载数")
    private Integer download;

    @ApiModelProperty("浏览数")
    private Integer view;

    @ApiModelProperty("每页文本内容嵌套类型")
    private List<EsPageObjectVO> pageContents;

    @ApiModelProperty("ES中每一个图片对象嵌套类型")
    private List<EsPicObjectVO> picContents;

    @Score(decimalPlaces = 2)
    @ApiModelProperty("相关性得分")
    private Float score;

    @ApiModelProperty("是否是英文文档")
    private Boolean isEnglish;

    @ApiModelProperty("Highlight内容")
    private Map<String,String> highlightContentMap;

    public void setFromEsFileObject(EsFileObject esFileObject) {
        this.id = esFileObject.getId();
        this.fileName = esFileObject.getFileName();
        this.thumbId = esFileObject.getThumbId();
        this.uploadDate = esFileObject.getUploadDate();
        this.uploadUser = esFileObject.getUploadUser();
        this.like = esFileObject.getLike();
        this.collect = esFileObject.getCollect();
        this.download = esFileObject.getDownload();
        this.view = esFileObject.getView();
        this.isEnglish = esFileObject.getIsEnglish();


    }
}